<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>数值-BigInt-ES11</title>
</head>

<body>
  <script>
    // 大整型
    /* let n = 521n;
    console.log(n, typeof n) */

    // 函数
    // let n = 123;
    // console.log(BigInt(n));
    // console.log(BigInt(1.2)); // 报错：Uncaught RangeError: The number 1.2 cannot be converted to a BigInt because it is not an integer at BigInt

    // 大数值运算
    let max = Number.MAX_SAFE_INTEGER;
    console.log(max);     // 9007199254740991
    console.log(max + 1); // 9007199254740992
    console.log(max + 2); // 9007199254740992

    console.log(BigInt(max));
    console.log(BigInt(max) + BigInt(1));
    console.log(BigInt(max) + BigInt(2));
  </script>
</body>

</html>